<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="#{systemConfigBean.memberTemplatePath}"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:p="http://primefaces.prime.com.tr/ui">

    <ui:define name="content">

        <p:growl id="operationReultMessage" globalOnly="true" />

        <h:form id="activeInstituteFrm">

            <p:panel id="activeInstitutes" header="#{msgs.ADMIN_MANAGE_INSTITUTES_ACTIVE_INSTITUTES}" toggleable="true">
                <p:dataTable id="tbl1" value="#{manageInstitutesBean.activeInstitutes}" var="item"  widgetVar="tbl1"
                             emptyMessage="#{msgs.GEN_NO_DATA_FOUND}" rows="10" paginator="true"
                             paginatorAlwaysVisible="false"
                             selectionMode="single">

                    <p:column sortBy="#{item.instituteName}" filterBy="#{item.instituteName}" filterMatchMode="contains">
                        <f:facet name="header">
                            <h:outputText value="#{msgs.ADMIN_MANAGE_INSTITUTES_INSTITUTE_NAME}" />
                        </f:facet>                    
                        <h:outputText value="#{item.instituteName}" rendered="#{sessionInfo.locale eq 'ar'}"/>
                        <h:outputText value="#{item.instituteNameS}" rendered="#{sessionInfo.locale ne 'ar'}"/>
                    </p:column>

                    <p:column styleClass="columnStyleCenter iconColumn">
                        <f:facet name="header">
                            <h:outputText value="#{msgs.GEN_DETAILS}" />
                        </f:facet>                    
                        <p:commandButton id="details" process="@this" action="#{manageInstitutesBean.setSelectedInstitute(item)}" update="selectedInstituteInfoDialog" oncomplete="instituteDialog.show()"  image="ui-icon ui-icon-zoomin" title="#{msgs.GEN_DETAILS}">
                            <f:setPropertyActionListener value="#{item}"  target="#{manageInstitutesBean.selectedInstitute}" />  
                        </p:commandButton>
                    </p:column>

                    <p:column styleClass="columnStyleCenter iconColumn">
                        <f:facet name="header">
                            <h:outputText value="#{msgs.GEN_UPDATE}" />
                        </f:facet>                    
                        <p:commandButton id="update" ajax="false"  action="update" image="ui-icon ui-icon-wrench" title="#{msgs.GEN_UPDATE}">
                            <f:setPropertyActionListener value="#{item}"  target="#{requestScope.selectedInstitute}" />  
                        </p:commandButton>
                    </p:column>

                    <p:column styleClass="columnStyleCenter iconColumn">
                        <f:facet name="header">
                            <h:outputText value="#{msgs.GEN_DEACTIVATE}" />
                        </f:facet>
                        <p:commandButton  id="deactivate" process="@this" image="ui-icon ui-icon-close" 
                                          title="#{msgs.GEN_DEACTIVATE}" onclick="deactivateConfirmation.show()">
                            <f:setPropertyActionListener value="#{item}"  target="#{manageInstitutesBean.selectedInstitute}" />  
                        </p:commandButton>
                    </p:column>
                </p:dataTable>
            </p:panel>
        </h:form>


        <p:spacer id="sep1" height="40"/>




        <p:dialog widgetVar="instituteDialog" showEffect="fade" hideEffect="fade" modal="true" header="#{msgs.ADMIN_MANAGE_INSTITUTES_INFO}" >
            <p:outputPanel id="selectedInstituteInfoDialog" >
                <h:panelGrid columns="2" width="100%" columnClasses="columnStyleFormLabel columnStyleAlign_#{sessionInfo.locale}, columnStyleFormData columnStyleAlignInverse_#{sessionInfo.locale}">
                    <h:outputLabel for="instNo" value="#{msgs.ADMIN_MANAGE_INSTITUTES_NO} :" />
                    <h:outputText id="instNo" value="#{manageInstitutesBean.selectedInstitute.instituteNo}" styleClass="formData" />

                    <h:outputLabel value="#{msgs.ADMIN_MANAGE_INSTITUTES_NAME} :" />
                    <h:outputText id="instName" value="#{manageInstitutesBean.selectedInstitute.instituteName}" styleClass="formData" />

                    <h:outputLabel value="#{msgs.ADMIN_MANAGE_INSTITUTES_NAME_S} :" />
                    <h:outputText id="instNameS" value="#{manageInstitutesBean.selectedInstitute.instituteNameS}" styleClass="formData" />

                    <h:outputLabel value="#{msgs.ADMIN_MANAGE_INSTITUTES_INITIAL} :" />
                    <h:outputText id="instInit" value="#{manageInstitutesBean.selectedInstitute.instituteInitials}" styleClass="formData" />

                    <h:outputLabel value="#{msgs.ADMIN_MANAGE_INSTITUTES_COUNTRY} :" />
                    <h:outputText id="instCountry" value="#{manageInstitutesBean.selectedInstitute.countryNo.countryName}" rendered="#{sessionInfo.locale eq 'ar'}" styleClass="formData"/>
                    <h:outputText id="instCountryS" value="#{manageInstitutesBean.selectedInstitute.countryNo.countryNameS}" rendered="#{sessionInfo.locale ne 'ar'}" styleClass="formData"/>

                    <h:outputLabel value="#{msgs.ADMIN_MANAGE_INSTITUTES_CITY} :" />
                    <h:outputText id="city" value="#{manageInstitutesBean.selectedInstitute.cityNo.cityName}" rendered="#{sessionInfo.locale eq 'ar'}" styleClass="formData"/>
                    <h:outputText id="cityS" value="#{manageInstitutesBean.selectedInstitute.cityNo.cityNameS}" rendered="#{sessionInfo.locale ne 'ar'}" styleClass="formData"/>

                    <h:outputLabel value="#{msgs.ADMIN_MANAGE_INSTITUTES_WEBSITE} :" />
                    <h:outputText id="instwebSite" value="#{manageInstitutesBean.selectedInstitute.webSite}"  styleClass="formData"/>

                    <h:outputLabel value="#{msgs.ADMIN_MANAGE_INSTITUTES_POBOX} :" />
                    <h:outputText id="instPOBOX" value="#{manageInstitutesBean.selectedInstitute.POBox}"  styleClass="formData"/>     

                    <h:outputLabel value="#{msgs.ADMIN_MANAGE_INSTITUTES_PHONE} :" />
                    <h:outputText id="instPhone" value="#{manageInstitutesBean.selectedInstitute.phone}"  styleClass="formData"/>  

                    <h:outputLabel value="#{msgs.ADMIN_MANAGE_INSTITUTES_FAX} :" />
                    <h:outputText id="instFax" value="#{manageInstitutesBean.selectedInstitute.fax}"  styleClass="formData"/>  

                    <h:outputLabel value="#{msgs.ADMIN_MANAGE_INSTITUTES_COMPUTER_CENTER_EMAIL} :" />
                    <h:outputText id="instEmail" value="#{manageInstitutesBean.selectedInstitute.computerCenterEmail}"  styleClass="formData"/>  

                    <h:outputLabel value="#{msgs.ADMIN_MANAGE_INSTITUTES_CREATED_BY} :" />
                    <h:outputText id="instUsrName" value="#{manageInstitutesBean.selectedInstitute.createdBy.fullName}" rendered="#{sessionInfo.locale eq 'ar'}" styleClass="formData"/>  
                    <h:outputText id="instUsrNameS" value="#{manageInstitutesBean.selectedInstitute.createdBy.fullNameS}" rendered="#{sessionInfo.locale ne 'ar'}" styleClass="formData"/>

                    <h:outputLabel value="#{msgs.ADMIN_MANAGE_INSTITUTES_CREATED_DATE} :" />
                    <h:outputText id="instDate" value="#{manageInstitutesBean.selectedInstitute.createdDate}"  styleClass="formData"/>                      
                </h:panelGrid>
            </p:outputPanel>          
        </p:dialog>

        <h:form id="activateConfirmationFrm">
            <p:confirmDialog message="#{msgs.ADMIN_MANAGE_INSTITUTES_DEACTIVATE_CONFIRMATION}"  
                             showEffect="fade" hideEffect="fade" 
                             header="#{msgs.GEN_SURE}" 
                             severity="alert" widgetVar="deactivateConfirmation"
                             modal="true">  

                <p:commandButton image="ui-icon ui-icon-close" title="#{msgs.GEN_NO}" oncomplete="deactivateConfirmation.hide()"/>  
                <p:commandButton image="ui-icon ui-icon-check" action="#{manageInstitutesBean.deactivateSelectedInstitute}" 
                                 update="operationReultMessage, activeInstituteFrm:tbl1, inactiveInstutesFrm:tbl2" 
                                 oncomplete="tbl1.clearFilters(); deactivateConfirmation.hide()"
                                 title="#{msgs.GEN_YES}"/>   

            </p:confirmDialog>   
        </h:form>

        <h:form id="deaAtivateConfirmationFrm">
            <p:confirmDialog message="#{msgs.ADMIN_MANAGE_INSTITUTES_ACTIVATE_CONFIRMATION}"  
                             showEffect="fade" hideEffect="fade" 
                             header="#{msgs.GEN_SURE}" 
                             severity="alert" widgetVar="activateConfirmation"
                             modal="true">  

                <p:commandButton image="ui-icon ui-icon-close" title="#{msgs.GEN_NO}" oncomplete="activateConfirmation.hide()"/>  
                <p:commandButton image="ui-icon ui-icon-check" action="#{manageInstitutesBean.activateSelectedInstitute}" 
                                 update="operationReultMessage, activeInstituteFrm:tbl1, inactiveInstutesFrm:tbl2" 
                                 oncomplete="tbl2.clearFilters(); activateConfirmation.hide()"
                                 title="#{msgs.GEN_YES}"/>   

            </p:confirmDialog>   
        </h:form>
    </ui:define>
    

</ui:composition>
